<template>
	<view>
		<view>
			<navTop title="社长审核" :isHeight="false" hasBgc="white" :color="navtop.color" :isBack="true"></navTop>
		</view>
		<view class="tabs">
			<u-tabs
			:list="list2" 
			lineWidth="30"
			lineColor="#feba4a"
			itemStyle="padding-left:30rpx;padding-right:-60rpx;width:284rpx; height:80rpx; "
			
			@click="click"  
			:activeStyle="{
			            color: '#101010 100%',
			            fontWeight: 'bold',
			            transform: 'scale(1.05)',
						
			        }"
			:inactiveStyle="{
			            color: '#9B9B9B 100%',
			            transform: 'scale(1)'
			        }"
			></u-tabs>
		</view>
<!-- 		<view class="examineCard">
			<examineCard 
				v-if="isTabs.name==0"
				v-for="(item,index) in actData"
				:key="index"
				:title="item.nickName"
				:src="item.avatarUrl"
			></examineCard>
			
		</view> -->
		
		<view class="actCard">
			<!-- <examine-card_association v-if="isTabs.name==1"></examine-card_association> -->
			<actCard_examine
			v-show="isTabs.name==0"
			v-for="(item,index) in actData"
			:key="index"
			:title="item.event_name"
			:src="imgUrl+item.img_id"
			:item="item"
			></actCard_examine>
			<associationCard_examine v-show="isTabs.name==1"
			v-for="(item,index) in AssostionData"
			:item="item"
			:src="imgUrl+item.img_id">
				</associationCard_examine>
		</view>
	</view>
</template>

<script>
	import examineCard from '../../components/examineCard.vue'
	import examineCard_association from '../../components/examineCard_association.vue'
	import actCard_examine from '../../components/actCard_examine.vue'
	import associationCard_examine from '../../components/associationCard_examine.vue'
	import {
		mapState,
		mapMutations
	} from 'vuex'
	import navTop from '../../components/navTop.vue'
	export default {
		components: {
			navTop,
			examineCard,
			examineCard_association,
			actCard_examine,
			associationCard_examine
		},
		data(){
			return{
				user_Id:this.$store.state.userInfo.id,
				imgUrl:'https://www.codingyt.com/getImage/',
				act_Id:'',
				actData:[],
				AssostionData:[],
				isTabs:{
					name:'',
				},
				list2: [
					{
						name: '活动 ACTIVITY',
					}, 
					{
						name: '社团 ASSOCIATION',
					},
				],
				navtop: {
					title: 'XXX',
					color: '#000000'
				},
			}
		},
		methods:{
			click(item) {
			     
				 this.isTabs.name=item.index;
			},
			getEventData(){
				let userId = this.user_Id
				let actId = this.act_Id
				let that = this
				let eventId='';
				uni.request({
				    url: 'https://www.codingyt.com/club/userEvent/select',
				    data: {
				        userId,
						eventId:'',
						role:'president',
				    },
				    success: (res) => {
						let data=[]
						var tmpdata=res.data.data
						for (var i = 0; i < tmpdata.length; i++) {
							if(tmpdata[i].role=='president'){
								data.push(tmpdata[i])
							}
						}
						that.actData=data
					
				    }
				});
			},
			getAssostionData(){
				let that=this;
					let userId = this.user_Id
				uni.request({
					url:'https://www.codingyt.com/club/userOrganization/select',
					data:{
						userId,
						role:'president',
					},
					success(res) {
						let data=[]
						var tmpdata=res.data.data
						for (var i = 0; i < tmpdata.length; i++) {
							if(tmpdata[i].role=='president'){
								data.push(tmpdata[i])
							}
						}
						that.AssostionData=data
						
					}
				})
			}
		},
		onLoad() {
			this.getEventData();
			this.getAssostionData();
			
		},
	}
</script>

<style scoped lang="scss">
	@import "@/uni_modules/uview-ui/index.scss";
	.tabs{
		left: 30rpx;
		top: 200rpx;
		color: rgba(16, 16, 16, 100);
		font-size: 48rpx;
		position: absolute;
	}
	.actCard{
		left: 0rpx;
		top: 256rpx;
		position: absolute;
	}
</style>
